<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改产品信息')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-productInfo-edit" th:object="${productInfo}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">产品名称：</label>
                <div class="col-sm-8">
                    <input name="productName" th:field="*{productName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">产品说明：</label>
                <div class="col-sm-8">
                    <textarea name="productDescription" class="form-control">[[*{productDescription}]]</textarea>
                </div>
            </div>
<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">涉及接口：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="interfaceId" id="interfaceId" class="form-control selectpicker" multiple data-live-search="true" title="请选择">-->
<!--                        <option th:each="interfaceInfo : ${interfaceInfoList}" th:text="${interfaceInfo.interfaceName}" th:value="${interfaceInfo.id}"></option>-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->

<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">版本类型：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="versionType" id="versionType" class="form-control m-b" th:with="type=${@dict.getType('productVersionType')}">-->
<!--                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{versionType}"></option>-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">状态：</label>
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
                    <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
                    <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "product/productInfo";
        $("#form-productInfo-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $('#form-productInfo-edit').serializeArray();
                // var interfaceIds = $('#interfaceId').selectpicker('val');
                // data.push({"name": "interfaceIds", "value": interfaceIds});
                $.operate.save(prefix + "/edit", data);
            }
        }
        var interfaceIds = [[${interfaceIds}]]
        $(function () {
            $('#interfaceId').selectpicker('val', interfaceIds);
        });
    </script>
</body>
</html>